# First with two for loops, then swap the minimum element with the first unsorted element
def selection_sort(arr):
    n = len(arr)
    for i in range(n):
        min_index = i

        for j in range(i + 1, n):
            if arr[j] < arr[min_index]:
                min_index = j

        arr[i], arr[min_index] = arr[min_index], arr[i]
    return arr

# Second version with a while loop
def selection_sort_while(arr):
    n = len(arr)
    i = 0
    while i < n:
        min_index = i
        j = i + 1
        while j < n:
            if arr[j] < arr[min_index]:
                min_index = j
            j += 1
        arr[i], arr[min_index] = arr[min_index], arr[i]
        i += 1
    return arr

# Example usage:
if __name__ == "__main__":
    data = [64, 25, 12, 22, 11]
    print("Original array:", data)
    sorted_data = selection_sort(data)
    sorted_data_while = selection_sort_while(data)
    print("Sorted array with double for loop:", sorted_data)
    print("Sorted array with while loop:", sorted_data_while)